﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using System.Configuration;
using System.Collections;

namespace FinalProject.BL
{
    public static class Utilities
    {
        private static readonly string _connectionString = System.Configuration.ConfigurationManager.ConnectionStrings["InvoiceModelContext"].ConnectionString;
        public static string ConnectionString
        {
            get
            {
                return _connectionString;
            }
        }

        #region **Extension Methods**
        public static bool IsNullOrEmpty(this ICollection list)
        {
            if (list == null || list.Count == 0) return true;
            return false;
        }

        public static bool IsNullOrEmpty<T>(this ICollection<T> list)
        {
            if (list == null || list.Count == 0) return true;
            return false;
        }

        public static Guid ToGuid(this object value)
        {
            if (value == null) return Guid.Empty;
            Guid result = Guid.Empty;
            Guid.TryParse(value.ToString(), out result);
            return result;
        }
        #endregion
    }
}
